package gui;
import guiCode.studGradeAsscode;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.Color;
import java.awt.GridBagLayout;
import javax.swing.JPanel;
import javax.swing.JLabel;
import javax.swing.table.DefaultTableModel;

import java.awt.Rectangle;
import java.awt.Font;
import java.sql.SQLException;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

public class studGradeAssGUI extends JPanel{
	TeacherMainMenuGUI tmmc;
	studGradeAsscode sgac;
	private JTable table;
	public JTable table_1;
	public JScrollPane scrollPane_1;
	JButton button;
	public JLabel label;
	public JButton btnDownloadEvaluationFile;
	public JButton btnDownloadCommentsFiles;
	public String AID;//ass id
	public String SID;//studentID
	public JLabel lblFileNotExist;
	
	public studGradeAssGUI() {
		super();
		initialize();
	}
	private void initialize() {
	this.setSize(900,600);
	this.setBackground(UIManager.getColor("InternalFrame.activeTitleBackground"));
	SpringLayout springLayout = new SpringLayout();
	setLayout(springLayout);
	
	JPanel panel = new JPanel();
	springLayout.putConstraint(SpringLayout.NORTH, panel, 81, SpringLayout.NORTH, this);
	springLayout.putConstraint(SpringLayout.WEST, panel, 24, SpringLayout.WEST, this);
	springLayout.putConstraint(SpringLayout.SOUTH, panel, -23, SpringLayout.SOUTH, this);
	springLayout.putConstraint(SpringLayout.EAST, panel, 870, SpringLayout.WEST, this);
	panel.setBackground(UIManager.getColor("InternalFrame.activeTitleBackground"));
	add(panel);
	SpringLayout sl_panel = new SpringLayout();
	panel.setLayout(sl_panel);
	
	JLabel lblListOfAssignments = new JLabel("List of student that commit the assigment:");
	lblListOfAssignments.setFont(new Font("Tahoma", Font.BOLD, 15));
	panel.add(lblListOfAssignments);
	
	table_1 = new JTable();
	table_1.setModel(new DefaultTableModel(
		new Object[][] {
			{null, null, null, null},
		},
		new String[] {
			"New column", "New column", "New column", "New column"
		}
	));
	
	scrollPane_1 = new JScrollPane(table_1);
	sl_panel.putConstraint(SpringLayout.NORTH, scrollPane_1, 124, SpringLayout.NORTH, panel);
	sl_panel.putConstraint(SpringLayout.WEST, scrollPane_1, 241, SpringLayout.WEST, panel);
	sl_panel.putConstraint(SpringLayout.EAST, scrollPane_1, -111, SpringLayout.EAST, panel);
	sl_panel.putConstraint(SpringLayout.WEST, lblListOfAssignments, 0, SpringLayout.WEST, scrollPane_1);
	sl_panel.putConstraint(SpringLayout.SOUTH, lblListOfAssignments, -21, SpringLayout.NORTH, scrollPane_1);
	panel.add(scrollPane_1);
	
	button = new JButton("back to assignment list");
	button.setFont(new Font("Tahoma", Font.BOLD, 13));
	sl_panel.putConstraint(SpringLayout.WEST, button, 83, SpringLayout.WEST, panel);
	sl_panel.putConstraint(SpringLayout.SOUTH, button, -56, SpringLayout.SOUTH, panel);
	panel.add(button);
	
	JLabel lblAssigmentName = new JLabel("assigment name");
	lblAssigmentName.setFont(new Font("Tahoma", Font.PLAIN, 15));
	lblAssigmentName.setForeground(Color.BLUE);
	sl_panel.putConstraint(SpringLayout.NORTH, lblAssigmentName, 27, SpringLayout.NORTH, panel);
	sl_panel.putConstraint(SpringLayout.WEST, lblAssigmentName, 50, SpringLayout.WEST, panel);
	panel.add(lblAssigmentName);
	
	label = new JLabel("assName");
	sl_panel.putConstraint(SpringLayout.NORTH, label, 29, SpringLayout.NORTH, panel);
	sl_panel.putConstraint(SpringLayout.WEST, label, 30, SpringLayout.EAST, lblAssigmentName);
	sl_panel.putConstraint(SpringLayout.EAST, label, 100, SpringLayout.EAST, lblAssigmentName);
	label.setFont(new Font("Tahoma", Font.PLAIN, 14));
	label.setForeground(Color.BLUE);
	panel.add(label);
	
	btnDownloadEvaluationFile = new JButton("Download Evaluation File");
	sl_panel.putConstraint(SpringLayout.SOUTH, scrollPane_1, -28, SpringLayout.NORTH, btnDownloadEvaluationFile);
	btnDownloadEvaluationFile.setFont(new Font("Tahoma", Font.BOLD, 13));
	sl_panel.putConstraint(SpringLayout.WEST, btnDownloadEvaluationFile, 0, SpringLayout.WEST, lblListOfAssignments);
	panel.add(btnDownloadEvaluationFile);
	btnDownloadEvaluationFile.setEnabled(false);
	
	btnDownloadCommentsFiles = new JButton("Download Comments Files");
	sl_panel.putConstraint(SpringLayout.WEST, btnDownloadCommentsFiles, -207, SpringLayout.EAST, scrollPane_1);
	btnDownloadCommentsFiles.setFont(new Font("Tahoma", Font.BOLD, 13));
	sl_panel.putConstraint(SpringLayout.NORTH, btnDownloadCommentsFiles, 0, SpringLayout.NORTH, btnDownloadEvaluationFile);
	sl_panel.putConstraint(SpringLayout.EAST, btnDownloadCommentsFiles, 0, SpringLayout.EAST, scrollPane_1);
	panel.add(btnDownloadCommentsFiles);
	btnDownloadCommentsFiles.setEnabled(false);
	
	lblFileNotExist = new JLabel("File Not Exist");
	sl_panel.putConstraint(SpringLayout.NORTH, lblFileNotExist, 277, SpringLayout.NORTH, panel);
	sl_panel.putConstraint(SpringLayout.SOUTH, btnDownloadEvaluationFile, -26, SpringLayout.NORTH, lblFileNotExist);
	lblFileNotExist.setIcon(new ImageIcon(studGradeAssGUI.class.getResource("/javax/swing/plaf/metal/icons/ocean/warning.png")));
	lblFileNotExist.setFont(new Font("Tahoma", Font.PLAIN, 14));
	lblFileNotExist.setForeground(Color.RED);
	sl_panel.putConstraint(SpringLayout.WEST, lblFileNotExist, 269, SpringLayout.WEST, panel);
	panel.add(lblFileNotExist);
	lblFileNotExist.setVisible(false);
}
}
